<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>添加或编辑界面</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
    <style>
        .w440 {
            width: 440px !important;
        }
    </style>
</head>
<body>
<div class="page-content-wrap clearfix">
    <form class="layui-form" id="tool">
        <div class="layui-tab">
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;申请部门：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="organName" value="${assetWarranty.organName}" lay-verify="required" placeholder="请输入申请部门" autocomplete="off"
                                   class="layui-input" maxlength="200">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;联系方式：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="mobile" value="${assetWarranty.mobile}" lay-verify="required" placeholder="请输入联系方式" autocomplete="off"
                                   class="layui-input" maxlength="200">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;物品类型：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="assetType" value="${assetWarranty.assetType}" lay-verify="required" placeholder="请输入物品类型" autocomplete="off"
                                   class="layui-input" maxlength="200">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;物品名称：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="title" value="${assetWarranty.title}" lay-verify="required" placeholder="请输入物品名称" autocomplete="off"
                                   class="layui-input" maxlength="200">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;物品地点：</label>
                        <div class="layui-input-inline w440">
                            <input type="text" name="location" value="${assetWarranty.location}" lay-verify="required" placeholder="请输入物品地点" autocomplete="off"
                                   class="layui-input" maxlength="200">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">&nbsp;故障描述：</label>
                        <div class="layui-input-inline w440">
                            <textarea class="layui-textarea" name="description" autocomplete="off" placeholder="请输故障描述" maxlength="2000">${assetWarranty.description}</textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="red">*</span>&nbsp;图片：</label>
                        <div class="layui-input-block cy-uploadpic-ctn" id="objectId" style=" float:left;margin-left:0!important;position:relative;"></div>
                    </div>

                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block" style="margin-left: 0px !important;text-align: center">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">保存</button>
                <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
                <button type="button" style="display: none;" id="save" class="layui-btn layui-btn-primary"></button>
            </div>
        </div>
    </form>
</div>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['jquery', 'form', 'page', 'fileUtil', 'baseutil'], function () {
        var $ = layui.jquery,
            form = layui.form,
            page = layui.page,
            fileUtil = layui.fileUtil,
            baseutil = layui.baseutil;

        page.initDict('bannerType', function (dictData) {
            page.showDict($("#bannerType"), page.aceeptDictContentList(dictData, 'bannerType'), "请选择", '${banner.bannerType}');
        });
        //初始化附件控件
        fileUtil.uploadImage('objectId', "work/asset/mult", '${assetWarranty.objectId}');


        //监听保存
        form.on('submit(saveBtn)', function (data) {
            data.field.id = '${assetWarranty.id}';
            data.field.assetState = '${assetWarranty.assetState}';
            data.field.applyId = '${assetWarranty.applyId}';
            data.field.usrId = '${assetWarranty.userId}';
            baseutil.post("/work/asset/addOrUpdate", data.field, function () {
                $("#save").click();
            });
            return false;
        });
    });
</script>
</body>
</html>